/* 复选框对勾 */
.ele-file-list-group .ele-file-icon-check {
  position: relative;
  display: inline-block;
  box-sizing: border-box;

  &:before {
    content: '';
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
    position: absolute;
    left: 4px;
    top: 5px;
  }
}

/*-----------file-grid-item-------------*/
// 文件列表网格布局item
.ele-file-list-item {
  display: inline-block;
  box-sizing: border-box;
  padding: 10px 3px 10px 3px;
  margin: 0 0 8px 8px;
  text-align: center;
  position: relative;
  cursor: pointer;

  // body
  .ele-file-list-item-body {
    position: relative;
    z-index: 1;
  }

  // 图标
  .ele-file-list-item-icon {
    position: relative;

    & > img {
      width: 56px;
      height: 56px;
      margin: 14px 0;
      border-radius: 2px;
      display: inline-block;
    }

    & > .ele-file-list-item-icon-image {
      margin: 0;
      width: 84px;
      height: 84px;
      object-fit: cover;
    }
  }

  // 标题
  .ele-file-list-item-title {
    width: 110px;
    margin-top: 4px;
    box-sizing: border-box;
    text-overflow: ellipsis;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;

    &:not(:hover) {
      color: inherit;
    }
  }

  // 复选框
  .ele-file-list-item-check {
    position: absolute;
    top: 6px;
    right: 6px;
    border-radius: 50%;
    display: none;
    z-index: 1;

    .ele-file-icon-check {
      width: 19px;
      height: 19px;
      border-radius: 50%;
      display: block;
      opacity: 0.35;
    }
  }

  &.checked .ele-file-list-item-check,
  &:hover .ele-file-list-item-check {
    display: block;
  }

  &.checked .ele-file-list-item-check .ele-file-icon-check {
    opacity: 1;
  }

  // 背景和边框
  .ele-file-list-item-bg,
  .ele-file-list-item-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    box-sizing: border-box;
    display: none;
  }

  &:hover .ele-file-list-item-bg,
  &.checked .ele-file-list-item-bg {
    opacity: 0.06;
    display: block;
  }

  &.checked .ele-file-list-item-border {
    opacity: 0.3;
    border-width: 1px;
    border-style: solid;
    display: block;
  }
}

/*-----------file-grid-------------*/
// 文件列表网格布局
.ele-file-list {
  box-sizing: border-box;
  position: relative;

  // header
  .ele-file-list-header {
    padding: 0 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid hsla(0, 0%, 60%, 0.15);
    box-sizing: border-box;
    line-height: 36px;
    display: flex;

    // 全选框
    .ele-file-list-check-group {
      display: inline-flex;
      align-items: center;
      cursor: pointer;

      .ele-file-list-check {
        width: 16px;
        height: 16px;
        border-radius: 2px;
        margin-right: 13px;

        &:before {
          top: 4px;
          left: 3px;
          width: 8px;
          height: 4px;
        }

        &:not(.checked) {
          background-color: transparent !important;
          border: 1px solid hsla(0, 0%, 60%, 0.3);

          &:before {
            display: none;
          }
        }
      }
    }
  }
}

/**-----------file-sort-------------*/
// 文件列表表头排序图标
.ele-file-list-table-item-sort {
  width: 8px;
  height: 14px;
  margin-left: 6px;
  position: relative;
  display: inline-block;

  & > i {
    width: 0;
    height: 0;
    border-width: 4px;
    border-style: solid;
    border-left-color: transparent !important;
    border-right-color: transparent !important;
    display: block;

    &:first-child {
      border-top-color: transparent !important;
      margin: -4px 0 4px 0;
    }

    &:last-child {
      border-bottom-color: transparent !important;
    }
  }

  &:not(.ele-file-list-sort-asc) > i:first-child {
    border-bottom-color: hsla(0, 0%, 60%, 0.6) !important;
  }

  &:not(.ele-file-list-sort-desc) > i:last-child {
    border-top-color: hsla(0, 0%, 60%, 0.6) !important;
  }
}

/*-----------file-table-item-------------*/
// 文件列表表格布局item
.ele-file-list-table-item {
  // 图标和标题
  .ele-file-list-table-item-icon {
    flex: 1;
    height: 24px;
    overflow: hidden;
  }

  .ele-file-list-table-item-icon-image {
    width: 24px;
    height: 24px;
    object-fit: cover;
    display: inline-block;
    vertical-align: top;
    cursor: pointer;
  }

  .ele-file-list-table-item-title {
    display: inline;
    padding-left: 10px;
    box-sizing: border-box;
    word-break: break-all;
    vertical-align: top;
    line-height: 24px;
    cursor: pointer;

    &:not(:hover) {
      color: inherit;
    }
  }

  // 工具按钮
  .ele-file-list-table-item-tool-group {
    flex-shrink: 0;
    display: none;
    align-items: center;
    box-sizing: border-box;
    padding: 0 15px;
    cursor: default;

    .ele-file-list-item-tool {
      margin-right: 15px;
      font-size: 16px;
      cursor: pointer;
      line-height: 1;
    }
  }

  &:hover .ele-file-list-table-item-tool-group {
    display: flex;
  }

  // 背景和边框
  .ele-file-list-table-item-bg,
  .ele-file-list-table-item-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: none;
  }

  &:hover .ele-file-list-table-item-bg,
  &.checked .ele-file-list-table-item-bg {
    opacity: 0.06;
    display: block;
  }

  &:hover .ele-file-list-table-item-border,
  &:not(.ele-file-list-table-item-header):hover
    + .ele-file-list-table-item
    .ele-file-list-table-item-border,
  &.checked .ele-file-list-table-item-border,
  &.checked + .ele-file-list-table-item .ele-file-list-table-item-border {
    opacity: 0.3;
    border-top-width: 1px;
    border-top-style: solid;
    display: block;
  }

  &:not(.ele-file-list-table-item-header):last-child:hover
    .ele-file-list-table-item-border,
  &:not(.ele-file-list-table-item-header):last-child.checked
    .ele-file-list-table-item-border {
    border-bottom-width: 1px;
    border-bottom-style: solid;
  }
}

/*-----------file-table-------------*/
// 文件列表表格布局
.ele-file-list-table {
  position: relative;

  // item
  .ele-file-list-table-item {
    line-height: 44px;
    position: relative;

    // body
    .ele-file-list-table-item-body {
      display: flex;
      align-items: center;
      border-top: 1px solid hsla(0, 0%, 60%, 0.15);
      position: relative;
      z-index: 1;
    }

    &:last-child .ele-file-list-table-item-body {
      border-bottom: 1px solid hsla(0, 0%, 60%, 0.15);
    }

    &:first-child .ele-file-list-table-item-body {
      border-top: none;
    }

    // 列宽设置
    .ele-file-list-table-item-check-group {
      width: 45px;
      padding-left: 16px;
      box-sizing: border-box;
      flex-shrink: 0;
    }

    .ele-file-list-table-item-name {
      flex: 1;
      position: relative;
      display: flex;
      align-items: center;
    }

    .ele-file-list-table-item-size {
      width: 120px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
    }

    .ele-file-list-table-item-time {
      width: 180px;
      flex-shrink: 0;
      display: flex;
      align-items: center;
    }

    // 复选框
    .ele-file-list-table-item-check {
      width: 16px;
      height: 16px;
      border-radius: 2px;
      display: inline-block;
      vertical-align: -3px;
      cursor: pointer;

      &:before {
        left: 3px;
        top: 4px;
        width: 8px;
        height: 4px;
      }
    }

    &:not(.checked) .ele-file-list-table-item-check {
      background-color: transparent !important;
      border: 1px solid hsla(0, 0%, 60%, 0.3);

      &:before {
        display: none;
      }
    }
  }

  // header
  .ele-file-list-table-item-header {
    line-height: 36px;
    cursor: pointer;
  }
}

/* 小屏幕样式 */
@media screen and (max-width: 768px) {
  .ele-file-list-table .ele-file-list-table-item {
    .ele-file-list-table-item-size,
    .ele-file-list-table-item-time {
      display: none;
    }

    .ele-file-list-table-item-tool-group {
      padding-right: 0;
    }
  }
}
